package com.ocom.payconfig.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ocom.common.entity.payconfig.EntityPackageVoucher;
import com.ocom.common.request.callpackage.OnShowPackageDetail;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.io.Serializable;
import java.util.Collection;
import java.util.List;

@Mapper
public interface IDaoPackageVoucher extends BaseMapper<EntityPackageVoucher> {

    @Select({"<script>",
            " SELECT\n" +
                    " p.com_id,\n" +
                    " p.package_type_id,\n" +
                    " p.voucher_type_id,\n" +
                    " p.number,\n" +
                    " v.voucher_type_name,\n" +
                    " v.attribute,\n" +
                    " v.cons_type,\n" +
                    " v.par_value,\n" +
                    " v.status\n" +
                    " FROM\n" +
                    " package_voucher p\n" +
                    " LEFT JOIN voucher_type v ON p.com_id = v.com_id\n" +
                    " AND p.voucher_type_id = v.voucher_type_id\n" +
                    " WHERE\n" +
                    " p.com_id = #{comId}" +
                    "</script>"})
    List<OnShowPackageDetail> selectByComId(@Param("comId") Long comId);
}
